
import React, { Component } from 'react';
class One extends Component {
    constructor(props) {
        super(props);
        this.state = { 
            flag:true
         };
    }
    change(){
        const {flag} = this.state;
        
        this.setState({
            flag :!flag
        })
        
    }
    render() {
        const {flag} = this.state;
        const res = flag?"我喜欢你":"你喜欢我";
        return (
           <div>
               <p>{res}</p>
               <div onClick={(e)=>this.change()} >你好</div>
            </div>
        );
    }
}

export default One;